/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.gov.mtc.dgac.licencias.service;

import java.util.HashMap;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import pe.gov.mtc.dgac.licencias.bean.ClienteoperadorTO;
import pe.gov.mtc.dgac.licencias.bean.FuncionTO;
import pe.gov.mtc.dgac.licencias.bean.OperadorAereoTO;
import pe.gov.mtc.dgac.licencias.exception.BusinessException;
import pe.gov.mtc.dgac.licencias.persistence.ClienteoperadorDAO;
import pe.gov.mtc.dgac.licencias.struts.Constants;

/**
 *
 * @author externo.gamaro
 */
public class ClienteoperadorImplService implements ClienteoperadorService{
    private ClienteoperadorDAO dao;
     Log logger = LogFactory.getLog(this.getClass());
    public ClienteoperadorImplService(ClienteoperadorDAO dao){
      this.dao=dao;
    }
    public List<ClienteoperadorTO> buscarClienteOperador(ClienteoperadorTO cliope) throws BusinessException {
        List<ClienteoperadorTO> result=null;
        try{
             result=dao.buscarClienteOperador(cliope);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_CLIENTE_OPERADOR_CONSULTA.getValue(),e);
        }
        
        return result;
    }

    public List<OperadorAereoTO> buscarOperador(OperadorAereoTO ope) throws BusinessException {
       List<OperadorAereoTO> result=null;
        try{
             result=dao.buscarOperador(ope);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_CLIENTE_OPERADOR_CONSULTA.getValue(),e);
        }
        
        return result;
    }

    public List<FuncionTO> buscarFuncion(FuncionTO func) throws BusinessException {
        List<FuncionTO> result=null;
        try{
             result=dao.buscarFuncion(func);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_CLIENTE_OPERADOR_CONSULTA.getValue(),e);
        }
        
        return result;
    }

    public HashMap insertClienteOperador(ClienteoperadorTO cliope) throws BusinessException {
        HashMap result=null;
        try{
             result=dao.insertClienteOperador(cliope);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_CLIENTE_OPERADOR_UPDATE.getValue(),e);
        }
        
        return result;
    }

    public HashMap deleteClienteOperador(ClienteoperadorTO cliope) throws BusinessException {
        HashMap result=null;
        try{
             result=dao.deleteClienteOperador(cliope);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_CLIENTE_OPERADOR_UPDATE.getValue(),e);
        }
        
        return result;
    }

    public HashMap updateClienteOperador(ClienteoperadorTO cliope) throws BusinessException {
         HashMap result=null;
        try{
             result=dao.updateClienteOperador(cliope);
        }catch(Exception e){
          logger.error(e);
	  throw new BusinessException(Constants.MESSAGE_ERROR_CLIENTE_OPERADOR_UPDATE.getValue(),e);
        }
        
        return result;
    }
    

}
